home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15747 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  773 b 

  1. Path: news.compulink.gr!athena!lonewolf
  2. From: lonewolf@athena.compulink.gr (Costas Vlassis)
  3. Newsgroups: comp.lang.c
  4. Subject: strncpy() ?
  5. Date: 21 Apr 1996 15:41:33 GMT
  6. Organization: CompuLink Network S.A.
  7. Message-ID: <4ldkvd$553@venus.compulink.gr>
  8. NNTP-Posting-Host: 193.92.197.99
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11.  
  12.     Well I have this question, let's say we have the following :
  13.  
  14. char alfa[40] = "1123";
  15. char beta[20];
  16. char gama[20];
  17.  
  18. With strncpy(beta,alfa,2) beta = "11" that's fine but HOW can I make 
  19. gama = "23" that is the last 2 characters of alfa or even "3" the last 
  20. character... Is there a function that takes start and end as strings ?
  21.  
  22. what I want is something like :
  23.  
  24. strncpy2 (beta,alfa,2,4);
  25.  
  26.     is this possible ?
  27.  
  28.     Costas Vlassis
  29.     lonewolf@compulink.gr
  30.  
  31.